package io.github.syske.springbootjdbcmybatisdemo.config;

import io.github.syske.springbootjdbcmybatisdemo.entity.Locate;
import org.springframework.context.annotation.Configuration;
import org.apache.commons.dbcp2.BasicDataSource;
import java.sql.Connection;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;

@Configuration
public class JDBCUtil {

   public static final String url = "jdbc:oracle:thin:@127.0.0.1:1521/MWMS";
   public static final String user = "std_mwms_whqr";
   public static final String password = "hsbk_feng_whqr";


   public BasicDataSource getApacheDataSource(){
      BasicDataSource dataSource = new BasicDataSource();
      dataSource.setDriverClassName("oracle.jdbc.driver.OracleDriver");
      dataSource.setUrl(url);
      dataSource.setUsername(user);
      dataSource.setPassword(password);

      return dataSource;
   }

   public static void main(String[] args) {
      List<Locate> list = new ArrayList<>();
      Locate l1 =new Locate();
      l1.locate="001-001-03";
      list.add(l1);
      List<Locate> collect = list.stream().filter(locate -> locate.locate.indexOf("-01")>0)
              .collect(Collectors.toList());
      System.out.println(collect);
   }
}
